﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

namespace DAL
{
    /// <summary>
    /// Summary description for Brand
    /// </summary>
    public partial class Brand
    {
        public static string[] GetBrandList(string prefixText, int count)
        {
            using (DAL.EShopDBDataContext db = new DAL.EShopDBDataContext(ConfigurationManager.ConnectionStrings["EShopConnectionString"].ConnectionString))
            {
                var brands = from b in db.Brands
                             where b.Title.StartsWith(prefixText)
                             select b.Title;
                return brands.ToArray<string>();
            }
        }
        public static Category[] GetCategories(int brandId)
        {
            using (DAL.EShopDBDataContext db = new DAL.EShopDBDataContext())
            {
                return db.Brand_GetCategories(brandId).ToArray<DAL.Category>();
            }
        }
    }
}